package world.zwq.gulimall.search.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import world.zwq.gulimall.search.service.MallSearchService;
import world.zwq.gulimall.search.vo.SearchParam;
import world.zwq.gulimall.search.vo.SearchResult;

/**
 * @author zhangwq
 * @date 2021/8/8 8:13
 */
@Controller
public class SearchController {

    @Autowired
    MallSearchService mallSearchService;

    /**
     *
     * @return
     */
    @GetMapping(value = {"/list.html","/"})
    public String listPage(SearchParam param, Model model){
        SearchResult result = mallSearchService.search(param);
        model.addAttribute("result",result);
        return "list";
    }

}
